package com.cardvalue.sys.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.baidu.location.e.p;
import com.cardvalue.sys.R;
import com.cardvalue.sys.adapter.IndustryRecylerAdapter;
import com.cardvalue.sys.adapter.LinkRecylerAdapter;
import com.cardvalue.sys.adapter.LinkRecylerListAdapter;
import com.cardvalue.sys.base.BaseActivity;
import com.cardvalue.sys.cache.LocalCache;
import com.cardvalue.sys.code.CallBackCode;
import com.cardvalue.sys.entity.Industrylist;
import com.cardvalue.sys.entity.MoreListDto;
import com.cardvalue.sys.entity.SelHasLeaseContract;
import com.cardvalue.sys.entity.User;
import com.cardvalue.sys.fragment.BasicFragment;
import com.cardvalue.sys.fragment.UploadFragment;
import com.cardvalue.sys.mode.UserService;
import com.cardvalue.sys.tool.DividerItemDecoration;
import com.cardvalue.sys.tool.Utiltools;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.Realm;
import io.realm.RealmResults;

/**
 *列表类   就是只用id和title的
 */
public class LinkActivity extends BaseActivity {
    @Bind(R.id.iv_left)  ImageView  iv_left;//返回键
    @Bind(R.id.recyclerView) RecyclerView mRecyclerView;
    private LinkRecylerAdapter mAdapter;//融资期限的adapter
    private IndustryRecylerAdapter mIndustryRecylerAdapter;//行业
    private ArrayList<SelHasLeaseContract> mDirectTypAdapter= new ArrayList<>();//直系亲属类型
    private List<SelHasLeaseContract>  mSelHasLeaseContract;//是否有租赁合同，为何没有租赁合同
    private LinkRecylerListAdapter mSelAdapter;//是否有租赁合同，为何没有租赁合同的adapter
    private Industrylist industrylist; //实体类
    private UserService updateInfo;
    private String tagName;
    private String id;
    private  SelHasLeaseContract item;
    private  String  Gid;//第一个id
    private  String  PId;//第二个id
    private  String  CId;//第三个id
    private String industryPId;


    private String  tille1="";
    private String  tille2="";
    private List<Industrylist>  Industrylist1=new ArrayList<>();
    private List<Industrylist>  Industrylist2=new ArrayList<>();
    private List<Industrylist>  Industrylist3=new ArrayList<>();
    private List<Industrylist>  currentlist=new ArrayList<>();
    private int setp = 1;
    private String one, two, three;
    private Realm realm ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_link);
        ButterKnife.bind(this);
        realm = Realm.getDefaultInstance();
        setHeaderFields(0, R.string.title_se,0,R.mipmap.back, 0,0);

        item=new SelHasLeaseContract();
        item.setId(0);
        item.setTitle("父母");
        mDirectTypAdapter.add(item);

        item=new SelHasLeaseContract();
        item.setId(1);
        item.setTitle("子女");
        mDirectTypAdapter.add(item);

        item=new SelHasLeaseContract();
        item.setId(2);
        item.setTitle("配偶");
        mDirectTypAdapter.add(item);
        updateInfo=new UserService(this);
        //创建一个线性布局管理器,然后设置布局的方向
        LinearLayoutManager  layoutManager= new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayout.VERTICAL);
        //设置布局管理器
        mRecyclerView.setLayoutManager(layoutManager);
        tagName = getIntent().getStringExtra("tagName");



       /* if(getIntent().getStringExtra("id")!=null){
            Gid=getIntent().getStringExtra("id");
            Utiltools.printE("第一级的时候gid",Gid+"====Gid===");
            JSONObject object = new JSONObject();
            try {
                object.put("industryGId", getIntent().getStringExtra("id"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
            id = object.toString();
        }*/

        mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this);
        mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
        mRecyclerView.setAdapter(mIndustryRecylerAdapter);
        updateInfo.getIndustrylist(null, null, new UserService.IndustryCallback() {
            @Override
            public void success(ArrayList<Industrylist> industrylists) {
                Industrylist1 = industrylists;
                currentlist.clear();
                currentlist.addAll(industrylists);
                mIndustryRecylerAdapter.update(currentlist);
            }

            @Override
            public void fail(String msg) {

            }

            @Override
            public void cancelDialog() {

            }
        });



        mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
            @Override
            public void OnItemClick(View v, final int position) {
                industrylist=currentlist.get(position);
                if(setp==1){
                    updateInfo.getIndustrylist(null, null, new UserService.IndustryCallback() {
                        @Override
                        public void success(ArrayList<Industrylist> industrylists) {
                            Gid=industrylists.get(position).getId();
                            Utiltools.printE("第一次点击的时候==第一级",Gid+"==11111=");
                            setp=2;
                            one = industrylists.get(position).getTitle();
                            Industrylist1 = industrylists;
                            currentlist.clear();
                            currentlist.addAll(industrylists);
                            mIndustryRecylerAdapter.update(currentlist);
                        }

                        @Override
                        public void fail(String msg) {

                        }

                        @Override
                        public void cancelDialog() {

                        }
                    });


                }else if(setp==2) {
                    one = industrylist.getTitle();
                    JSONObject id = new JSONObject();
                    try {
                        Utiltools.printE("第一次点击的时候==第2级+++=industryGId---",Gid+"----");
                        id.put("industryGId",Gid);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    updateInfo.getIndustrylist(id.toString(), null, new UserService.IndustryCallback() {
                        @Override
                        public void success(ArrayList<Industrylist> industrylists) {
                            //3
                            PId=industrylists.get(position).getId();
                            Utiltools.printE("第二次点击的时候==第二级",PId);
                            two = industrylists.get(position).getTitle();
                            Industrylist2 = industrylists;
                            currentlist.clear();
                            currentlist.addAll(industrylists);
                            mIndustryRecylerAdapter.update(currentlist);
                            setp=3;
                        }

                        @Override
                        public void fail(String msg) {

                        }

                        @Override
                        public void cancelDialog() {

                        }
                    });
                }else if(setp==3){
                    two = industrylist.getTitle();
                    Utiltools.printE("第二次点击的时候==第2级",PId);
                    JSONObject id = new JSONObject();
                    try {
                        id.put("industryPId",PId);
                        id.put("merchantId", LocalCache.getStringLocalData(LinkActivity.this,"objectId"));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    updateInfo.getIndustrylist(null, id.toString(), new UserService.IndustryCallback() {
                        @Override
                        public void success(ArrayList<Industrylist> industrylists) {
                            Utiltools.printE("第三次点击的时候==第三级",industrylists.get(position).getId());
                            Industrylist3= industrylists;
                            currentlist.clear();
                            currentlist.addAll(industrylists);
                            mIndustryRecylerAdapter.update(currentlist);


                            Message msg=new Message();
                            msg.what=0x1001;//行业
                            Bundle bundl=new Bundle();
                            bundl.putString("Gid",Gid);
                            bundl.putString("Pid",PId);
                            bundl.putString("Cid",industrylists.get(position).getId());
                            Log.e("Link", "```````:" + one + "|||" + two + "|||" + industrylists.get(position).getTitle());
                            bundl.putString("title",one+","+two+","+industrylists.get(position).getTitle());
                            msg.setData(bundl);
                            BasicFragment.handler.sendMessage(msg);
                            LinkActivity.this.finish();

                        }

                        @Override
                        public void fail(String msg) {

                        }

                        @Override
                        public void cancelDialog() {

                        }
                    });
                }
            }
        });



        /*if (setp == 1) {
            // 第一级

            updateInfo.getIndustrylist(null,null,new UserService.IndustryCallback() {
                @Override
                public void success(final ArrayList<Industrylist> industrylists) {

                    Industrylist1 = industrylists;

                    mIndustryRecylerAdapter.update(industrylists);

//                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
//                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
//                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                        @Override
                        public void OnItemClick(View v, int position) {

                            Industrylist industrylist=industrylists.get(position);
//                            Intent intent=new Intent(LinkActivity.this,LinkActivity.class);
//                            intent.putExtra("tagName","Industrylists");
//                            intent.putExtra("id",industrylist.getId());
//                            intent.putExtra("tille1",industrylist.getTitle());
//                            startActivity(intent);

                            one = industrylist.getTitle();
                            JSONObject id = new JSONObject();
                            try {
                                id.put("industryGId", industrylist.getId());
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }

                            updateInfo.getIndustrylist(id.toString(),null,new UserService.IndustryCallback() {
                                @Override
                                public void success(final ArrayList<Industrylist> industrylists) {

                                    setp++; // 2
                                    Industrylist2 = industrylists;
                                    mIndustryRecylerAdapter.update(industrylists);
//                                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
//                                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
//                                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
//                                    mIndustryRecylerAdapter.notifyDataSetChanged();
                                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                                        @Override
                                        public void OnItemClick(View v, int position) {
                                            Industrylist industrylistPid=industrylists.get(position);
//                                            Intent intent=new Intent(LinkActivity.this,LinkActivity.class);
//                                            intent.putExtra("tagName","industryP");
//                                            intent.putExtra("PId",industrylistPid.getId());
//                                            intent.putExtra("Gid",Gid);
//                                            intent.putExtra("tille1",tille1);
//                                            intent.putExtra("tille2",industrylistPid.getTitle());
//                                            startActivity(intent);

                                            two = industrylistPid.getTitle();

                                            JSONObject id = new JSONObject();
                                            try {
                                                id.put("industryPId", industrylistPid.getId());
                                                id.put("merchantId", LocalCache.getStringLocalData(LinkActivity.this,"objectId"));
                                            } catch (JSONException e) {
                                                e.printStackTrace();
                                            }

                                            updateInfo.getIndustrylist(null, id.toString(), new UserService.IndustryCallback() {
                                                @Override
                                                public void success(final ArrayList<Industrylist> industrylists) {

                                                    setp++; // 3
                                                    Industrylist3 = industrylists;
                                                    mIndustryRecylerAdapter.update(industrylists);

//                                                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
//                                                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
//                                                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                                                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                                                        @Override
                                                        public void OnItemClick(View v, int position) {
                                                            Industrylist industrylistPid=industrylists.get(position);
                                                            three = industrylistPid.getTitle();
//                                                            Message msg=new Message();
//                                                            msg.what=0x1001;//行业
//                                                            Bundle bundl=new Bundle();
//                                                            bundl.putString("Gid",Gid);
//                                                            bundl.putString("Pid",PId);
//                                                            bundl.putString("Cid",industrylistPid.getId());
//                                                            bundl.putString("title",tille1+","+tille2+","+industrylistPid.getTitle());
//                                                            msg.setData(bundl);
//                                                            BasicFragment.handler.sendMessage(msg);
//                                                            LinkActivity.this.finish();

                                                            Log.i("Link", "```````:" + one + "|||" + two + "|||" + three);
                                                        }
                                                    });
                                                }

                                                @Override
                                                public void fail(String msg) {

                                                }

                                                @Override
                                                public void cancelDialog() {

                                                }
                                            });
                                        }
                                    });
                                }

                                @Override
                                public void fail(String msg) {

                                }

                                @Override
                                public void cancelDialog() {

                                }
                            });
                        }
                    });
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });
        }
*/



        if(tagName.equals("PlanFundTerm")){
            updateInfo.getPlanFundTerm(new UserService.PlanFundTermCallback() {
                @Override
                public void success(final ArrayList<SelHasLeaseContract> planFundTerm) {
                    mAdapter=new LinkRecylerAdapter(LinkActivity.this,planFundTerm);
                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
                    mRecyclerView.setAdapter(mAdapter);
                    mAdapter.setOnItemClickListenter(new LinkRecylerAdapter.OnItemClickListenter() {
                        @Override
                        public void OnItemClick(View v, int position) {
                            SelHasLeaseContract planFund=planFundTerm.get(position);
                            Message msg=new Message();
                            msg.what=0x1000;//融资期限
                            Bundle bundle=new Bundle();
                            bundle.putInt("id",planFund.getId());
                            bundle.putString("title",planFund.getTitle());
                            msg.setData(bundle);
                            BasicFragment.handler.sendMessage(msg);
                            finish();

                        }
                    });
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });
        }else if(tagName.equals("directType")){//directType 直系亲属类型
            Utiltools.printE("fffffffffffff",mDirectTypAdapter+"fffffffffffffff");
            mAdapter=new LinkRecylerAdapter(LinkActivity.this,mDirectTypAdapter);
            mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
            mRecyclerView.setAdapter(mAdapter);
            mAdapter.setOnItemClickListenter(new LinkRecylerAdapter.OnItemClickListenter() {
                @Override
                public void OnItemClick(View v, int position) {
                    SelHasLeaseContract directTyp=mDirectTypAdapter.get(position);
                    Message msg=new Message();
                    msg.what= CallBackCode.CALLBACK_MSG_GETDIRECTTYPE;//融资期限
                    Bundle bundle=new Bundle();
                    bundle.putInt("id",directTyp.getId());
                    bundle.putString("title",directTyp.getTitle());
                    msg.setData(bundle);
                    UploadFragment.handler.sendMessage(msg);
                    Utiltools.printE("directTyp.getTitle()=====",directTyp.getTitle());
                    finish();
                }
            });
        }else if(tagName.equals("hasLeaseContract")){//  是否有租赁合同
            //从数据库中获取
            RealmResults<User> results2 = realm.where(User.class).findAll();
            User results1 =realm.where(User.class).equalTo("mobilePhone",LocalCache.getStringLocalData(LinkActivity.this,"mobilePhone")).findFirst();
            Utiltools.printE("setData--size-",results2.size()+"=====null-=====");
            if(TextUtils.isEmpty(results2.size()+"")){
                return;
            }
            mSelHasLeaseContract=results1.getSelHasLeaseContract();
            Utiltools.printE("hasLeaseContract",mSelHasLeaseContract+"hasLeaseContract");
            mSelAdapter=new LinkRecylerListAdapter(LinkActivity.this,mSelHasLeaseContract);
            mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
            mRecyclerView.setAdapter(mSelAdapter);
            mSelAdapter.setOnItemClickListenter(new LinkRecylerListAdapter.OnItemClickListenter() {
                @Override
                public void OnItemClick(View v, int position) {
                    SelHasLeaseContract hasLeaseContract=mSelHasLeaseContract.get(position);
                    Message msg=new Message();
                    msg.what= CallBackCode.CALLBACK_MSG_GETSELHASLEASECONTRACT;//是否有租赁合同
                    Bundle bundle=new Bundle();
                    bundle.putInt("id",hasLeaseContract.getId());
                    bundle.putString("title",hasLeaseContract.getTitle());
                    msg.setData(bundle);
                    UploadFragment.handler.sendMessage(msg);
                    Utiltools.printE("hasLeaseContract.getTitle()=====",hasLeaseContract.getTitle());
                    finish();
                }
            });
        }else if(tagName.equals("noLeaseContractReason")){// 为何没有租赁合同
            //从数据库中获取
            RealmResults<User> results2 = realm.where(User.class).findAll();
            User results1 =realm.where(User.class).equalTo("mobilePhone",LocalCache.getStringLocalData(LinkActivity.this,"mobilePhone")).findFirst();
            Utiltools.printE("setData--size-",results2.size()+"=====null-=====");
            if(TextUtils.isEmpty(results2.size()+"")){
                return;
            }
            mSelHasLeaseContract=results1.getSelNoLeaseContractReason();
            Utiltools.printE("hasLeaseContract",mSelHasLeaseContract+"hasLeaseContract");
            mSelAdapter=new LinkRecylerListAdapter(LinkActivity.this,mSelHasLeaseContract);
            mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
            mRecyclerView.setAdapter(mSelAdapter);
            mSelAdapter.setOnItemClickListenter(new LinkRecylerListAdapter.OnItemClickListenter() {
                @Override
                public void OnItemClick(View v, int position) {
                    SelHasLeaseContract hasLeaseContract=mSelHasLeaseContract.get(position);
                    Message msg=new Message();
                    msg.what= CallBackCode.CALLBACK_MSG_GETSELNOLEASECONTRACTREASON;//是否有租赁合同
                    Bundle bundle=new Bundle();
                    bundle.putInt("id",hasLeaseContract.getId());
                    bundle.putString("title",hasLeaseContract.getTitle());
                    msg.setData(bundle);
                    UploadFragment.handler.sendMessage(msg);
                    Utiltools.printE("hasLeaseContract.getTitle()=====",hasLeaseContract.getTitle());
                    finish();
                }
            });
        }


        /*else if(tagName.equals("Industry")){
            // 第一级
            updateInfo.getIndustrylist(null,null,new UserService.IndustryCallback() {
                @Override
                public void success(final ArrayList<Industrylist> industrylists) {
                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                        @Override
                        public void OnItemClick(View v, int position) {
                            Industrylist industrylist=industrylists.get(position);
                            Intent intent=new Intent(LinkActivity.this,LinkActivity.class);
                            intent.putExtra("tagName","Industrylists");
                            intent.putExtra("id",industrylist.getId());
                            intent.putExtra("tille1",industrylist.getTitle());
                            startActivity(intent);
                        }
                    });
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });

        }if(tagName.equals("Industrylists")){
            // 第二级
            if(getIntent().getStringExtra("tille1")!=null){
                tille1= getIntent().getStringExtra("tille1");
            }
            updateInfo.getIndustrylist(id,null,new UserService.IndustryCallback() {
                @Override
                public void success(final ArrayList<Industrylist> industrylists) {
                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                    mIndustryRecylerAdapter.notifyDataSetChanged();
                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                        @Override
                        public void OnItemClick(View v, int position) {
                            Industrylist industrylistPid=industrylists.get(position);
                            Intent intent=new Intent(LinkActivity.this,LinkActivity.class);
                            intent.putExtra("tagName","industryP");
                            intent.putExtra("PId",industrylistPid.getId());
                            intent.putExtra("Gid",Gid);
                            intent.putExtra("tille1",tille1);
                            intent.putExtra("tille2",industrylistPid.getTitle());
                            startActivity(intent);


                            updateInfo.getIndustrylist(null, industryPId, new UserService.IndustryCallback() {
                                @Override
                                public void success(final ArrayList<Industrylist> industrylists) {
                                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
                                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
                                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                                        @Override
                                        public void OnItemClick(View v, int position) {
                                            Industrylist industrylistPid=industrylists.get(position);
                                            Message msg=new Message();
                                            msg.what=0x1001;//行业
                                            Bundle bundl=new Bundle();
                                            bundl.putString("Gid",Gid);
                                            bundl.putString("Pid",PId);
                                            bundl.putString("Cid",industrylistPid.getId());
                                            bundl.putString("title",tille1+","+tille2+","+industrylistPid.getTitle());
                                            msg.setData(bundl);
                                            BasicFragment.handler.sendMessage(msg);
                                            LinkActivity.this.finish();
                                        }
                                    });
                                }

                                @Override
                                public void fail(String msg) {

                                }

                                @Override
                                public void cancelDialog() {

                                }
                            });
                        }
                    });
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });

        }else if(tagName.equals("industryP")){
            // 第三级
            if(getIntent().getStringExtra("Gid")!=null){
                Gid=getIntent().getStringExtra("Gid");
                Utiltools.printE("第三次跳转的时候的gid",Gid+"===Gid===");
            }
            if(getIntent().getStringExtra("tille1")!=null){
                tille1=getIntent().getStringExtra("tille1");
            }
            if(getIntent().getStringExtra("tille2")!=null){
                tille2 =getIntent().getStringExtra("tille2");
            }
            if(getIntent().getStringExtra("PId")!=null){
                PId=getIntent().getStringExtra("PId");
                JSONObject objectPid = new JSONObject();
                try {
                    objectPid.put("industryPId",getIntent().getStringExtra("PId"));
                    objectPid.put("merchantId", LocalCache.getStringLocalData(this,"objectId"));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                industryPId  =objectPid.toString();
            }
            updateInfo.getIndustrylist(null, industryPId, new UserService.IndustryCallback() {
                @Override
                public void success(final ArrayList<Industrylist> industrylists) {
                    mIndustryRecylerAdapter=new IndustryRecylerAdapter(LinkActivity.this,industrylists);
                    mRecyclerView.addItemDecoration(new DividerItemDecoration(LinkActivity.this,LinearLayoutManager.VERTICAL));
                    mRecyclerView.setAdapter(mIndustryRecylerAdapter);
                    mIndustryRecylerAdapter.setOnItemClickListenter(new IndustryRecylerAdapter.OnItemClickListenter() {
                        @Override
                        public void OnItemClick(View v, int position) {
                            Industrylist industrylistPid=industrylists.get(position);
                            Message msg=new Message();
                            msg.what=0x1001;//行业
                            Bundle bundl=new Bundle();
                            bundl.putString("Gid",Gid);
                            bundl.putString("Pid",PId);
                            bundl.putString("Cid",industrylistPid.getId());
                            bundl.putString("title",tille1+","+tille2+","+industrylistPid.getTitle());
                            msg.setData(bundl);
                            BasicFragment.handler.sendMessage(msg);
                            LinkActivity.this.finish();
                        }
                    });
                }

                @Override
                public void fail(String msg) {

                }

                @Override
                public void cancelDialog() {

                }
            });
        }*/
    }



    @OnClick(R.id.iv_left) void clickBack(){

        if(setp==0){
            finish();
        }else  if(setp==1){
            finish();
            // mIndustryRecylerAdapter.update(Industrylist1);
        } else if(setp==2){
            mIndustryRecylerAdapter.update(Industrylist1);
            setp--;
        }else if(setp==3){
            mIndustryRecylerAdapter.update(Industrylist2);
            setp--;
        }


    }
}
